<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        // 1、创建一个电脑对象，该对象主要有颜色、重量、品牌、型号，可以看电影、听音乐、打游戏和敲代码。
        var computer = new Object();
        computer.color = '黑色';
        computer.weight = '3kg';
        computer.brand = '神州';
        computer.model = '战神';
        computer.play = function(play) {
            console.log(play);
        }
        console.log(computer.color);
        console.log(computer.weight);
        console.log(computer['brand']);
        console.log(computer['model']);
        computer.play('看电影');
        computer.play('听音乐');
        computer.play('打游戏');
        computer.play('敲代码');

        // 2、创建一个按钮对象，该对象中需要包含宽、高、背景颜色和点击行为
        var buttom = new Object();
        buttom.width = '20px';
        buttom.heigth = '10px';
        buttom.bgc = 'pink';
        buttom.onclick = function(onclick) {
            console.log(onclick);
        }
        console.log(buttom.width);
        console.log(buttom['height']);
        console.log(buttom['bgc']);
        buttom.onclick('点击');

        // 3、创建一个车的对象，该对象要有重量、颜色、牌子，可以载人、拉货和耕田
        var car = new Object();
        car.weight = '3t';
        car.color = '黑色';
        car.brand = '大众';
        car.action = function(action) {
            console.log(action);
        }
        console.log(car.weight);
        console.log(car.color);
        console.log(car['brand']);
        car.action('载人');
        car.action('拉货');
        car.action('耕田');
    </script>
</head>

<body>

</body>

</html>